package com.hx.learn.tx.jdbc;

import com.hx.learn.tx.jdbc.util.DBUtil;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

/**
 * @author jxlgcmh
 * @date 2020-05-17 12:56
 * @description
 */
public class Main {
    public static void main(String[] args) throws SQLException {
        Connection connection = DBUtil.getConnection();
        connection.setAutoCommit(false);
        String sql = "select * from user";

        Statement statement = connection.createStatement();
        ResultSet resultSet = statement.executeQuery(sql);
        while (resultSet.next()) {
            System.out.println("ID：" + resultSet.getString(1) + "，名字：" + resultSet.getString(2));
        }

    }
}
